//package com.meal.test.exception;
//
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * @Title: GlobalExceptionHandler
// * @Description: 统一异常处理类
// * @Author yangzhanghui
// * @Date 2020/5/923:58
// * @Version v1.0
// */
//@ControllerAdvice
//@ResponseBody
//public class GlobalExceptionHandler {
//
//    // 也可以将 BaseException 换为 RuntimeException
//    // 因为 RuntimeException 是 BaseException 的父类
//    @ExceptionHandler(BaseException.class)
//    public ResponseEntity<?> handleAppException(BaseException ex, HttpServletRequest request) {
//        ErrorReponse representation = new ErrorReponse(ex, request.getRequestURI());
//        return new ResponseEntity<>(representation, new HttpHeaders(), ex.getError().getStatus());
//    }
//
//    @ExceptionHandler(value = ResourceNotFoundException.class)
//    public ResponseEntity<ErrorReponse> handleResourceNotFoundException(ResourceNotFoundException ex, HttpServletRequest request) {
//        ErrorReponse errorReponse = new ErrorReponse(ex, request.getRequestURI());
//        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(errorReponse);
//    }
//}
